﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;
using Kooboo.CMS.Content.Models;

namespace KB
{
    public static class NameValueCollectionExtensions
    {
        public static T MapTo<T>(this NameValueCollection nvs)
            where T : TextContent, new()
        {
            var textcontent = new T();
            foreach (var key in nvs.AllKeys)
            {
                textcontent.Add(key, nvs[key]);
            }
            return textcontent;
        }
    }
}
